package com.wang.todoList.util;

import com.wang.todoList.constant.BaseConstant;

import java.util.HashMap;
import java.util.Map;

/**
 * 封装一些返回时所需要的东西
 * @author Zifan
 * @date 2021年07月10日17:05
 */
public class ResponseUtil {
    /**
     * 获取成功时的返回
     */
    public static Map<String,Object> getSuccessRes(){
        HashMap<String, Object> resMap = new HashMap<>();
        resMap.put("status", BaseConstant.REQUEST_SUCCESS);
        return resMap;
    }
    public static Map<String,Object> getSuccessRes(Object o){
        HashMap<String, Object> resMap = new HashMap<>();
        resMap.put("status", BaseConstant.REQUEST_SUCCESS);
        resMap.put("info",o);
        return resMap;
    }

    /**
     * 获取失败时的返回
     */
    public static Map<String,Object> getFailureRes(){
        HashMap<String, Object> resMap = new HashMap<>();
        resMap.put("status", BaseConstant.REQUEST_FAILURE);
        return resMap;
    }
    public static Map<String,Object> getFailureRes(Object o){
        HashMap<String, Object> resMap = new HashMap<>();
        resMap.put("status", BaseConstant.REQUEST_FAILURE);
        resMap.put("info",o);
        return resMap;
    }
}
